<template>
	<div>
		<AplidForm v-bind="formConfig" v-model="searchModel" @reset="onReset" @submit="onSearch"></AplidForm>
		<HtmlLabel :title="item.templateName" />
		<FrameMain :key="reloadKey" height="20rem"
			:src="modelUrl"
			:params="{
				...paramsObj,
				...searchModel,
			}"
		/>
	</div>
</template>

<script setup lang="ts">
import FrameMain from '@/views/aplid/FrameMain/index.vue'

const props = defineProps<{
	item: any
}>()

const paramsObj = {
	templateId: props.item.id,
}
const modelUrl = `/preview`
const reloadKey = ref(0)
const searchModel = ref({})
const formConfig = {
	inline: true,
	showBtn: true,
	labelPosition: 'left',
	column: [
		{
			label: '统计时间',
			prop: 'timeBetween',
			type: 'dateBetween',
			span: 8,
		},
		{
			label: '统计地区',
			prop: 'areas',
			type: 'DateBetween',
			span: 8,
		},
	],
}

const onReset = () => {
	searchModel.value = {}
}

const onSearch = (search, done) => {
	reloadKey.value = Math.random()
	done()
}
</script>

<style scoped></style>
